package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class MainActivity3 extends AppCompatActivity {
    ImageView image_avatar;
    Button btn_home,btn_tv,btn_dynamic,btn_mine;
    int k;
    int[] image_avatars = new int[]{
            R.drawable.touxiang1,
            R.drawable.touxiang2
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3);
        initView();
        btn_home();
        btn_tv();
        btn_dynamic();
        btn_mine();
    }
//    Intent intent4 = new Intent();
//                intent4.setClass(MainActivity.this,MainActivity13.class);
//    startActivity(intent4);
    private void btn_home() {
        btn_home.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent= new Intent();
                intent.setClass(MainActivity3.this,MainActivity3.class);
                startActivity(intent);
            }
        });
    }
    private void btn_tv() {
        btn_tv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent1= new Intent();
                intent1.setClass(MainActivity3.this,MainActivity4.class);
                startActivity(intent1);
            }
        });
    }
    private void btn_dynamic() {
        btn_dynamic.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent2= new Intent();
                intent2.setClass(MainActivity3.this,MainActivity5.class);
                startActivity(intent2);
            }
        });
    }
    private void btn_mine() {
        btn_mine.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent3= new Intent();
                intent3.setClass(MainActivity3.this,MainActivity6.class);
                startActivity(intent3);
            }
        });
    }
    private void initView() {
        btn_home=findViewById(R.id.button_home);
        btn_tv=findViewById(R.id.button_tv);
        btn_dynamic=findViewById(R.id.button_dynamic);
        btn_mine=findViewById(R.id.button_mine);
        image_avatar=findViewById(R.id.imageView_avatar);
        Intent intent= getIntent();
        k=intent.getIntExtra("image",0);
        image_avatar.setBackgroundResource(image_avatars[k]);
    }
}